var flows = {
    flow1: new JobFlow(new ScriptLogic({
        init: function (flowData) {
            flowData.newkey = "newValue1";
            print("init3:" + flowData.flowId);
        },
        execute: function (jobFlow) {
            jobFlow.log.info(jobFlow.jobFlowStatus)
            var jdbc = new JdbcPlugin().load("conf/config-dev.properties");
            print(jdbc.execute("select * from seaman_login"))
        },
        success: function (jobFlow) {
            print(jobFlow.jobFlowStatus);
        },
        error: function (jobFlow) {
            print("error");
        }
    }), "newFlow1"),
    flow2: new JobFlow(new ScriptLogic({
        init: function (flowData) {
            flowData.newkey = "newValue2";
            print("init2:" + flowData.flowId);
        },
        execute: function (jobFlow) {
            jobFlow.retryOnError = true
            jobFlow.log.info(jobFlow.jobFlowStatus)
            print(jobFlow.flowData.newkey);
        },
        success: function (jobFlow) {
            print(jobFlow.jobFlowStatus);
        },
        error: function (jobFlow) {
            print("error");
        }
    }), "newFlow2"),
    conf:function () {
        //this.flow2.retryOnError = true
    }
}

var job = {
    run: function () {
        print("job start")
        return new JobLogic({
            init: function (data) {
                flows.conf()
                print("job init")
            },
            createTree: function () {
                var flowTree = new JobTree();
                flowTree.add(JobTreeItem.createRoot(flows.flow1));
                flowTree.add(JobTreeItem.create(flows.flow2,flows.flow1.flowId));
                return flowTree;
            },
            complete: function (data) {
                print(data.DEFAULT_JOB_ID_KEY+" is complete")
            }
        })
    }
}


job.run();